use axum::{
    routing::{get, post},
    Router,
};

use crate::views::*;
use crate::auth2_views::*;

pub fn auth_server() -> Router {
    Router::new()
        .route("/registry", post(registry))
        .route("/login", post(login))
        .route("/valid_session", get(valid_session))
        .route("/registry_application", post(registry_application))
        .route("/get_application_list", get(get_my_application_list))
        .route("/gen_application_secret_key", get(gen_application_secret_key))
        .route("/get_my_auth_application_list", get(crate::views::get_my_auth_application_list))
}

pub fn auth2_server() -> Router {
    Router::new()
        .route("/logout", get(logout))
        .route("/authorize", get(auth2_authorize))
        .route("/app_content", get(app_content))
        .route("/authorize", post(auth2_login))
        .route("/token", post(auth2_token))
        .route("/myinfo", get(myinfo))
        .route("/get_my_auth_application_list", get(crate::auth2_views::get_my_auth_application_list))
}
